import { Injectable } from '@angular/core';
import { Observable} from 'rxjs';
import { Http} from '@angular/http';
import {GlobalService} from "../../../global.service";

@Injectable()
export class EditUserGroupService {

  constructor(
    private http:Http,
    private globalService:GlobalService,
  ) { }


  findUserGroupInfo(data): Observable<any>{
    return this.http.get(this.globalService.api+'/services/auth/findUserGroupInfo/'+data.code,{});
  }

  saveUserGroupInfo(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/saveUserGroupInfo',data);
  }

  findProblemSetInfos(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/findProblemSetInfos',data);
  }

  findProblemSetList(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/findProblemSetList',data);
  }



  addProblemSetToUserGroup(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/addProblemSetToUserGroup',data);
  }

  deleteProblemSetFromUserGroup(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/deleteProblemSetFromUserGroup',data);
  }

  addPinCodeToUserGroup(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/addPinCodeToUserGroup',data);
  }

  deletePinCodeFromUserGroup(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/deletePinCodeFromUserGroup',data);
  }

  addAccountInfoToUserGroup(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/auth/addAccountInfoToUserGroup',data);
  }

  deleteUserFromUserGroup(data): Observable<any>{
    console.log("send data:",data);
    return this.http.post(this.globalService.api+'/services/auth/deleteUserFromUserGroup',data);
  }

}
